<link rel="stylesheet" href="../addons/jy_bigwheel/resource/css/mobilepan.css?v=8"/>
<style>
.line-notice-animation {
	display: flex;
	overflow: hidden;
	margin-left:0;
	-webkit-box-flex: 1;
	-webkit-flex: 1;
	-ms-flex: 1;
	flex: 1;
	white-space: nowrap;
}
.line-animation {
    animation: 60s wordsLoop linear infinite normal;
}
@keyframes wordsLoop {
            0% {
                transform: translateX(200px);
                -webkit-transform: translateX(200px);
            }
            100% {
                transform: translateX(-100%);
                -webkit-transform: translateX(-100%);
            }
}
@-webkit-keyframes wordsLoop {
            0% {
                transform: translateX(200px);
                -webkit-transform: translateX(200px);
            }
            100% {
                transform: translateX(-100%);
                -webkit-transform: translateX(-100%);
            }
}
.icon img {
	width:2rem;
	height:2rem;
    border-radius:30%
}
.task-model-content {
    background: url(../images/success.png) no-repeat;
    background-size: 100%; 
    min-height: 10rem;
    background-color: #F2F3F8;
    border-radius: 0.5rem;
    padding-top: 0.7rem;
    color: gray;
}
.showcode {position: absolute;z-index:10;bottom:8rem;right:0;padding:0.15rem 0.3rem;font-size:0.6rem;color:#fff;background-color: rgb(0, 0, 0, 0.3);border-top-left-radius:1rem;border-bottom-left-radius:1rem;}

</style>
<div class='fui-page fui-page-current'>
    <div class="fui-content lottery-content" style="padding-bottom:4rem">
        <div class="lottery-title">
			<div class="line-notice-animation" style="color: #ffffff;line-height:2rem;background: #000000;opacity: 0.7;">
				<div class="line-animation">{{pagedata.game.marqueetip || '暂无中奖记录...'}}</div>
            </div>
        </div>
		<div ng-if="pagedata.pluginset.homelink" class="showcode" href="javascript:;" ng-click="access_json(pagedata.pluginset.homelink)">返回首页 <i class="icon icon-shouye" style="color:#fff;font-size: 0.6rem;"></i></div>
		<div ng-if="pagedata.game.id">
        <style>
            .lottery-content{
                background: url("{{tomedia(pagedata.game.pluginset.imgbg) || '../addons/jy_bigwheel/resource/images/bg-pan.png'}}");
                background-size: 100% 100%;
            }
        </style>
        <div class="lottery">
            <div class="wheel"  style="overflow: hidden; padding: 0; width: 16.4rem; height: 16.4rem">
                <ul class="wheel-light">
                    <li><i></i><i></i><i></i><i></i></li>
                    <li><i></i><i></i><i></i><i></i></li>
                    <li><i></i><i></i><i></i><i></i></li>
                    <li><i></i><i></i><i></i><i></i></li>
                    <li><i></i><i></i><i></i><i></i></li>
                    <li><i></i><i></i><i></i><i></i></li>
                </ul>
                <div style="height:auto;width:auto;margin: 1.2rem; overflow: hidden;border-radius: 100%;">
                <ul id="wheel" class="wheel-list" style="position: relative; z-index: 0;  overflow: hidden; margin:auto">

                </ul>
                </div>
                <div ng-click="pagedata.pointer()" class="wheel-pointer" ><i>GO</i></div>
            </div>
        </div>
        <div class="lottery_footer">
            <img class="lottery_memberhead" ng-src="{{tomedia(pagedata.member.avatar)}}">
            <p ng-if="pagedata.game.type<9">剩余抽奖次数:<span style="color: #ff3f4b">{{pagedata.game.lastnum}}</span>次</p>
			<p ng-if="pagedata.game.type==9">每次抽奖消耗:<span style="color: #ff3f4b">{{pagedata.game.delredfee}}</span>元红包</p>
			<p ng-if="pagedata.game.type==10">每次抽奖消耗:<span style="color: #ff3f4b">{{pagedata.game.delredfee}}</span>个积分</p>
			<p ng-if="pagedata.game.type==9">当前剩余<span style="color: #ff3f4b">{{pagedata.myredfee}}</span>元</p>
			<p ng-if="pagedata.game.type==10">当前剩余<span style="color: #ff3f4b">{{pagedata.member.credit1}}</span>个积分</p>
			<p ng-if="pagedata.game.type==11 && pagedata.daylastnum>0">今日剩余<span style="color: #ff3f4b">{{pagedata.daylastnum}}</span>次</p>
            <div class="lottery_row">
                <div class="lottery_col_6">
                    <a class="btn btn-danger" href="javascript:;" ng-click="pagedata.showrules=true;" style="width: 6rem;">奖励说明</a>
                </div>
                <div class="lottery_col_6">
                    <a class="btn btn-primary" href="javascript:;" ng-click="pagedata.showmylog=true;tool.get_list('jy_bigwheel/game/getlog/',true)" style="background-color: #13afbe;border-color: #13afbe;">我的中奖记录</a>
                </div>
            </div>
        </div>
		</div>
        <p ng-if="!pagedata.game.id" class="text-white text-center" style="font-size: 2.5rem;margin-top: 15rem">无活动</p>
		<div ng-if="pagedata.game.pluginset.adimg" style="margin-top:6rem;height:auto;width: 100%;padding:0.5rem">
			<img class="radius" style="width: 100%;height:auto" ng-src="{{tomedia(pagedata.game.pluginset.adimg)}}"/>
		</div>
    </div>

</div>
<div style="display: none" id="lottery_data"> 
    <div ng-repeat="value in pagedata.game.reward" class="panel" ng-class="{'panel-primary':pagedata.count==1,'panel-default':pagedata.count!=1}" ng-click="pagedata.get();">

    </div>
</div>

<div ng-if="pagedata.showsuccess">
    <div class="task-model" style="z-index:108">
        <div class="task-model-content c" style="">
		<img style="width:7rem;height:7rem;border-radius: 0.5rem;" ng-src="{{tomedia(pagedata.reward.image) ||'../addons/jy_bigwheel/resource/images/success.png'}}"/>
		<h4>{{pagedata.showtitle}}</h4>
		</div>
        <div ng-click="pagedata.showsuccess=false;pagedata.showmylog=true;tool.get_list('jy_bigwheel/game/getlog/',true)" class="task-model-footer task-btn-close">查看中奖记录</div>
    </div>
</div>

<div ng-if="pagedata.showfail">
    <div class="task-model" style="z-index:108">
        <div class="task-model-faile-content" ><h4>{{pagedata.showtitle}}</h4></div>
        <div ng-click="pagedata.showfail=false;pagedata.showmylog=true;tool.get_list('jy_bigwheel/game/getlog/',true)" class="task-model-footer task-btn-close">查看中奖记录</div>
    </div>
</div>
<div ng-if="pagedata.showrules" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<i class="closed icon icon-cuowu" style="font-size:1.2rem;top:100%;" ng-click="pagedata.showrules=false"></i>
			<div class="content-images" style="padding:0.5rem;height:20rem; overflow-y:scroll;">
					<div class="title bold" style="font-size:0.8rem">活动规则 / <small>Read Rule</small></div>
					<div class="text" style="padding-top:0.5rem;font-size:0.7rem" ng-bind-html="trust(pagedata.pluginset.rules)">
					</div>
			</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.showmylog" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<i class="closed icon icon-cuowu" style="font-size:1.2rem;top:100%;" ng-click="pagedata.showmylog=false"></i>
			<div class="fui-content" style="padding-bottom:0.5rem;background:#fff">
					<div class="fixed-title" style="margin-top:1rem">
									 <span class="befirst spacing">
										 <span class="icon icon-fengexianzuo" style="font-size:2rem;color:#666"></span>
									 </span> 
									 <span class="title-text bold" style="color:#333;line-height:2rem">参与明细</span> 
									 <span class="spacing">
										 <span class="icon icon-fengexianyou" style="font-size:2rem;color:#666"></span>
									 </span>
					</div>
					<div style="height:20rem; overflow-y:scroll;">
					<div class='content-empty' ng-show="!pagedata.list || pagedata.list.length<=0">
						<i class='fa fa-comment-o'></i><br/>暂时没有任何记录!
					</div>
					<div class="fui-list-group container" style="background:#fff;margin:0 0.3rem" ng-show="pagedata.list.length>0" >
						<div class="fui-list goods-item" ng-repeat="item in pagedata.list">
							<div class="fui-list-media">
								<img ng-if="item.member.avatar" ng-src="{{tomedia(item.member.avatar)}}" class="round" style="width:2rem;height:2rem">
								<i ng-if="!item.member.avatar" class="icon icon-my2"></i>
							</div>
							<div class="fui-list-inner">
								<div class='title'>
									<span class="red">{{item.typetitle}}
									<span ng-if="item.reward.bufee>0 && item.reward.type==8">：补贴￥{{item.reward.bufee || 0.00}}</span>
									<span ng-if="item.fee>0 && item.reward.type!=1 && item.reward.type!=8 && item.reward.type!=9">：{{item.fee}}</span>
									</span>
								</div>
								<div class='gray'>
									<span ng-if="item.status==1" class="label label-info">待兑换</span>
									<span ng-if="item.status==2" class="label label-success">已领取</span>
									<span ng-if="item.status==3" class="label label-success">已兑换</span>
								</div>
								<div class='title'>
									<span class='gray' style="font-size:0.6rem">{{item.createtime}}</span>
								</div>
							</div>
							<div class='fui-list-angle'>
								<span ng-if="item.reward.type!=1 && item.status==0" ng-click="post({'id':item.id},'/game/set_reward/')" class="btn btn-sm btn-success-o">点击领取</span>
								<span ng-if="item.reward.type==8 && item.status==2" ng-click="pagedata.show_verify(item.hexiaourl)" class="btn btn-sm btn-success-o">点击核销</span>
								<span ng-if="item.reward.type==1 && (item.status==0 || item.status==1)" ng-click="access_json(pagedata.createorder+item.id)" class="btn btn-sm btn-success-o">点击兑换</span>
								<span ng-if="item.reward.type==1 && item.status==3 && item.orderid>0" ng-click="access_json('jy_weishop/order.detail//id='+item.orderid)" class="btn btn-sm btn-success-o">查看订单</span>
							</div>
						</div>
					</div>
					</div>
			</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.showdelivery" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<i class="closed icon icon-cuowu" ng-click="pagedata.showdelivery=false"></i>
			<div class="code_box c" style="padding:1.5rem 0">
				<div style="padding:0.3rem">请将二维码出示给店员</div>
				<div class="img_box" id="show_verify_ewm">
					
				</div>
				<div class="cav_code" id="show_verify_code"></div>
				<div class="error">
					<div class="gray" style="padding: 0 1.3rem">温馨提示：为了更好的保护您利益,请不要轻易将您的核销二维码泄露给他人</div>
				</div>
			</div>
		</div>
	</div>
</div>
<!--分享弹层-->
<div id="showsharecover" class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
    <div class="modal-dialog" style="width:100%;left:0;top:0">
      <div id="cover">
        <div class='fui-mask-m visible'></div>
        <div class='arrow'></div>
        <div class='content'>请点击右上角<br/>通过【发送给朋友】<br/>转发给好友哦</div>
      </div>
    </div>
</div>
<script>
scope.tool.get_list('jy_bigwheel/game/getlog/',true);
scope.pagedata.scroll_bottom=function(){
	scope.tool.get_list('jy_bigwheel/game/getlog/');
}
scope.pagedata.show_verify=function(url,code){
	scope.tool.qr(url,'show_verify_ewm',150)
	scope.pagedata.showdelivery=true
	scope.$evalAsync();
}
</script>
<script type="text/javascript">
if(scope.pagedata.game.id){
    function buildpan() {
        $('#wheel').empty();
		var award=scope.pagedata.game.reward?scope.pagedata.game.reward:[]
		//console.log('award.length');console.log(award.length);
        for(var i=0; i<award.length; i++){
			//console.log('award');console.log(award[i]);
            var li_div = '<li class="jssuper"><i ></i><div class="prize"><h3>'+award[i].title+'</h3><div class="icon"><img src="'+award[i].image+'"></div></div></li>';
            $('#wheel').append(li_div);
            var pn = award.length;// 块数
            if(pn<4){
                pn=4;
            }
            var pa = 360/pn;// 每块角度
            for(var pi=0; pi<pn; pi++){
                $('#wheel').find('li').eq(pi).css('transform', 'rotate(' + pa*pi + 'deg)').find('i').css('transform', 'rotate('+ (pa/2) + 'deg) skewY(' + (90-pa) + 'deg)')
            }
        }
    }
	scope.pagedata.pointer=function(){
            if(scope.pagedata.click){
                return false;
            }
			var changes = scope.pagedata.has_changes;
            if(changes<=0){
                $('#model-failtitle').html('{{scope.pagdata.game.lottery_cannot}}');
                scope.pagedata.showfail=true;
                return ;
            }
            changes = changes - 1;
            $('#left_changes').html(changes);
            var reward = {};
			scope.post_json('jy_bigwheel/game/getreward/',{'id':scope.pagedata.game.id,'merchid':scope.pagedata.game.merchid},function(data){
				console.log(data)
                if(data.status==1 || data.status=='isad'){
					scope.pagedata.myredfee=data.myredfee;
					scope.pagedata.member.credit1 = data.credit1;
                    reward = data;
					scope.pagedata.reward=reward;
                    var num = data.id;
                    var pn = $('#wheel').find('li').length;
                    var pa = 360/pn;
                    $('#wheel').css('transform','rotate(' + (3600*scope.pagedata.runcount-num*pa) + 'deg)');
                    scope.pagedata.runcount++;
					scope.pagedata.game.lastnum--;
					scope.pagedata.daylastnum--;
                    scope.pagedata.click=true;
                    setTimeout(function () {
                        if(reward.is_reward){
                            //领取成功
							scope.post_json('jy_bigwheel/game/reward/',{'reward_id':parseInt(reward.id),'log_id':parseInt(reward.logid),'id':scope.pagedata.game.id},function(data){
                                //console.log('11');console.log(data);
								if(data.status==1){
                                    //领取成功
                                    scope.pagedata.showtitle=data.info;
                                    scope.pagedata.showsuccess=true;
                                    scope.pagedata.click=false;
                                }else{
                                    //领取失败model-fail-title
                                    scope.pagedata.showtitle=data.info;
                                    scope.pagedata.showfail=true;
                                }
								scope.$evalAsync();
                            });
                        }else{
                            //无奖励
							scope.pagedata.showtitle=reward.info;
                            scope.pagedata.showfail=true;
							scope.$evalAsync();
                        }
                        scope.pagedata.click=false;
                    },6000);
                }else{
                     scope.pagedata.showtitle=data.info;
                     scope.pagedata.showfail=true;
                     scope.pagedata.click=false;
					 scope.$evalAsync();
                }
            });
       }
        buildpan();
		if(!scope.pagedata.member.id){
			scope.confirm({
				'message':'请先登录，才能参与哦！',
				'success':function(){
					scope.access_json('core/member.login/');
				},
				'fail':function(){
					scope.access_json('core/member.login/');	
				}
			});
		}else{
			scope.pagedata.click=false;
			scope.pagedata.runcount = 1;
		}
}
</script>
